package com.shdaily.android;

import android.content.Context;  
import android.content.res.Resources;  
import android.widget.Button;  
import android.widget.LinearLayout;  
import android.widget.TextView;  
import android.os.Bundle;


public class ArticleView extends LinearLayout {

    //public Button buttonFavorite; 

    public ArticleView(Context context, String id, String title, String summary, String author,
    			String date, String body, String hasPic,int displayWidth){  
    	super(context);  
    	this.setOrientation(HORIZONTAL);  
    	

    	TextView titleText = new TextView(context);  
    	TextView dateText = new TextView(context);  
    	TextView authorText = new TextView(context);  
    	TextView bodyText = new TextView(context);   
    	
    	titleText.setText(title);  
    	dateText.setText(date);
    	authorText.setText(author);  
    	bodyText.setText(body);  
    	
    	LinearLayout main = new LinearLayout(getContext());  
    	titleText.setWidth(displayWidth-12);  
    	titleText.setTextSize(14);
    	
    	dateText.setWidth(displayWidth-12);  
    	dateText.setTextSize(10);
    	
    	authorText.setWidth(displayWidth-12);  
    	authorText.setTextSize(12);
    	
    	bodyText.setWidth(displayWidth-12);  
    	bodyText.setTextSize((float)10.5);
    	
    	main.setOrientation(VERTICAL);  
    	main.addView(titleText, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));  
    	main.addView(dateText, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));  
    	main.addView(authorText, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));  
    	main.addView(bodyText, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));  
    	addView(main, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));  
    	
    	/*buttonFavorite  = new Button(context);  
    	buttonFavorite.setText("Add to Favorite");  
    	buttonFavorite.setWidth(300);  

    	Resources res = getResources();  
    	buttonFavorite.setBackgroundDrawable(res.getDrawable(R.drawable.settingsfavorite));  
    	addView(buttonFavorite,new LinearLayout.LayoutParams(100,LayoutParams.WRAP_CONTENT));  
		*/
    }  

}
